
<!--待审核的个人用户-->
<template>
    <div>
        <el-tabs v-model="activeName2" type="card" >
            <el-tab-pane label="个人" name="first">

            </el-tab-pane>

        </el-tabs>
        <!--<el-form :inline="true" ref="form" :model="form">-->
            <!--<el-form-item label="姓名" prop="name">-->
                <!--<el-input placeholder="姓名" v-model="form.name"></el-input>-->
            <!--</el-form-item>-->
            <!--<el-form-item label="电话" prop="phone">-->
                    <!--<el-input placeholder="电话" v-model="form.phone"></el-input>-->
            <!--</el-form-item>-->
            <!--<el-form-item label="编辑人" prop="editMan">-->
                <!--<el-input placeholder="编辑人" v-model="form.editMan"></el-input>-->
            <!--</el-form-item>-->
            <!--<el-form-item label="客户经理" prop="manager">-->
                <!--<el-input placeholder="客户经理" v-model="form.manager"></el-input>-->
            <!--</el-form-item>-->
            <!--<el-form-item>-->
                <!--<el-button type="primary" @click="resetForm('form')">重置</el-button>-->
            <!--</el-form-item>-->
            <!--<el-form-item>-->
                <!--<el-button type="primary">查找</el-button>-->
            <!--</el-form-item>-->
        <!--</el-form>-->
        <div class="dateMsg" v-if="pageCount">总计<b>{{pageCount}}</b>条数据</div>
        <div>
            <el-table :data="tableData" style="width: 100%;margin-left:10px" v-loading="listLoading">
                <el-table-column prop="transcript_name" label="姓名">
                </el-table-column>
                <el-table-column prop="transcript_mobile" label="电话">
                </el-table-column>
                <el-table-column prop="enterprise_name" label="任职单位">
                </el-table-column>
                <el-table-column prop="transcript_duty" label="职位">
                </el-table-column>
                <el-table-column prop="create_time" label="提交时间">
                </el-table-column>
                <!--<el-table-column prop="transcript_belong" label="编辑人">-->
                <!--</el-table-column>-->
                <el-table-column prop="transcript_belong" label="客户经理">
                </el-table-column>
                <el-table-column prop="date" label="操作" >
                    <template scope="scope">
                        <el-button  type="text" size="small" @click="handleLook('checkDiolage',scope.row.transcript_id)" v-if="limit.limitId48.status==1">审核</el-button>
                        <!--<el-button type="text" size="small" @click="showDio('editDiolage')">编辑</el-button>-->
                        <el-button type="text" size="small" @click="del(scope.row.transcript_id)" v-if="limit.limitId50.status==1">弃置此副本</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <!--分页器-->
            <div  style="width:200px;margin-left:80%;margin-top: 10px">
                <el-pagination @current-change="getCurrentpage"
                               :page-size="10"
                        layout="prev, pager, next"
                        :total="pageCount">
                </el-pagination>
            </div>
        </div>
        <!--审核个人-->
        <el-dialog title="审核个人" :visible.sync="dialogeShow.checkDiolage" :modal="false" size="small" v-if="dialogeShow.checkDiolage">
            <personCheck></personCheck>
        </el-dialog>
        <!--编辑个人-->
        <el-dialog title="编辑个人" :visible.sync="dialogeShow.editDiolage" :modal="false" size="small" v-if="dialogeShow.editDiolage">
            <personEdit></personEdit>
        </el-dialog>
    </div>
</template>
<script>
    import Bus from '@/config/bus.js'
    import _http from '@/components/common/http.vue'
    import _param from '@/components/common/param.vue'
    import personEdit from '@/components/working/common/personEdit.vue'
    import personCheck from '@/components/working/common/personCheck.vue'
    //富文本
    import '@/assets/ueditor/ueditor.config.js'
    import '@/assets/ueditor/ueditor.all.min.js'
    import '@/assets/ueditor/ueditor.parse.min.js'
    import '@/assets/ueditor/lang/zh-cn/zh-cn.js'
    export default{
        components:{personCheck,personEdit},
        data(){
            return{
                formData:[],
                param:{
                    params:{
                        page:''
                    }
                },
                paramId:{
                    params:{
                        id:''
                    }
                },
                apiPort:{
//                    弃置接口
                    giveupApi:'transcript/personal/updateTflag',
//                   个人列表接口
                    selfList:'transcript/personal/list',
                },
                dialogeShow:{
                    checkDiolage:false,
                    editDiolage:false,
                },
                activeName2: 'first',
                form: {
                    phone:'',
                    editMan:'',
                    manager:'',
                    flag:'false',
                    name: '',
                    region: '',
                    date1: '',
                    date2: '',
                    delivery: false,
                    type: [],
                    resource: '',
                    desc: '',
                    upS:'',
                    aboutField:''
                },
                currentPage:'',
                pageAbout:{
                    pageNumber:1,
                    pageSize:10
                },

                pageCount:'',
                listLoading:false,
                tableData: [],
                userid:'',
                limit:''
            }
        },
        mounted(){
            this.limit = JSON.parse(localStorage.getItem("limitList"))
            console.log('打印权限的值')
            console.log(this.limit.limitId48.status)
            this.userid=localStorage.getItem('userId')
            this.pageAbout.userid = localStorage.getItem('userId')
            this.getTotal()
            var that = this
            Bus.$on('sendflagM', function(val){
                if(val==1){
                    that.getCurrentpage(that.currentPage)
                    setTimeout(function(){
                        that.hideDio('checkDiolage')
                    },800)
                }
            });
        },
        beforeDestroy(){
            Bus.$off("sendflagM")
        },
        methods:{
            getCurrentpage(val){
                this.listLoading=true
                var that = this
                this.currentPage = val ? val:1
                this.pageAbout.pageNumber=this.currentPage
                var params = that.querystring.stringify(this.pageAbout)
                _http.axiosRequest(that,that.apiPort.selfList,params,(res)=>{
                    that.pageCount=res.data.data.total
                console.log(res)
                this.listLoading=false
                that.tableData = res.data.data.records
            })
            },
//            获取首页数据
            getTotal(){
                this.listLoading=true
                var that = this
                var params = that.querystring.stringify(this.pageAbout)
                _http.axiosRequest(that,that.apiPort.selfList,params,(res)=>{
                    console.log(res)
                that.pageCount=res.data.data.total
                this.listLoading=false
                that.tableData = res.data.data.records
                console.log(that.tableData)
            })
            },
            //            组件间传参数，编辑页面
            handleLook(param,id){
                this.showDio(param)
                setTimeout(function(){
                    Bus.$emit('sentData',id)
                },200);
            },
            banFormatLength:function(row,column){
                var ban = row[column.property];
                if ( ban.length >10  ){
                    return ban.replace(',','|').substring(0,10)+'...' ;
                }
                return ban;
            },
////            组件间传参数查看页面
//            handleCheck(param,index,row){
//                this.showDio(param)
//                setTimeout(function(){
//                    Bus.$emit('getCheck',row)
//                },100)},
                handleCurrentChange(val){
                this.getData(val)
            },
            getData(date){
                var that = this
                var params = that.querystring.stringify({page:date,userid:that.userid})
                _http.axiosGetparam(that,that.apiPort.personCheck,that.param,(res)=>{

                console.log(res.data.data)
                console.log(res)
                this.form = res.data
                this.pageCount=res.data.total
                 this.formData = res.data.data
            })
            },
//            重置按钮
                resetForm(formName){
                this.$refs[formName].resetFields();
            },
            showDio(parram){
                this.dialogeShow[parram]=true
            },
            hideDio(parram){
                this.dialogeShow[parram]=false
            },
            del(id) {
                 var that = this
                this.$confirm('此操作将弃置该副本, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    var param = {transcript_id:id,userid:that.userid}
                    var params = that.querystring.stringify(param)
                    _http.axiosRequest(that,that.apiPort.giveupApi,params,(res)=>{
                    console.log(res)
                if(res.data.code==100){
                    that.$message({
                        message: '弃置成功',
                        type: 'success'
                    });
                    that.getCurrentpage(that.currentPage)
                }if(res.data.code==-500){
                    that.$message({
                        message: '企业不存在',
                        type: 'warning'
                    });
                }if(res.data.code==500){
                    that.$message({
                        message: '弃置失败',
                        type: 'warning'
                    });
                }
            })
            }).catch(() => {

            });
            }
        }
    }
</script>
<style>
    .dateMsg{
        padding-left: 20px;
        color: red;
        padding:10px
    }
</style>